#include <iostream>
#include <vector>
#include <string>
#include <cstring>
#include <algorithm>
#include <map>
#include <climits>
#include <set>
#include <stack>
using namespace std;
class Student{
public:
    string name;
    double chinese,math,english,sum;
    Student(string _name,double _ch,double _ma,double _en):name(_name),chinese(_ch),math(_ma),english(_en){
        sum=chinese+math+english;
    }
    bool operator==(const Student &b) const{
        return chinese==b.chinese&&math==b.math&&english==b.english;
    }
    bool operator<(const Student &b) const{
        return sum < b.sum;
    }
};
bool cmp(const Student &a,const Student &b){
    if(a.sum!=b.sum)
        return a.sum>b.sum;
    else if(a.chinese != b.chinese)
        return a.chinese>b.chinese;
    else if(a.math !=b.math)
        return a.math> b.math;
    else if(a.english!=b.english)
        return a.english>b.english;
    else{
        return a.name< b.name;
    }
}

int main(){
    vector<Student> all_stu;
    string name;
    int ch,ma,en;
    int cnt=10;
    while(cnt--){
        cin >> name>>ch>>ma>>en;
        if(ch<=100&&ch>=60&&ma<=100&&ma>=60&&en<=100&&en>=60){
            all_stu.emplace_back(name,ch,ma,en);
        }
    }
    sort(all_stu.begin(),all_stu.end(),cmp);
    cout << "[First round name list]"<<endl;
    for(auto stu:all_stu){
        cout << stu.name << " "<<stu.chinese<<" " << stu.math << " "<<stu.english <<endl;
    }
    cout << "\n[Final name list]"<<endl;
    stack<Student> myset;
    for(auto stu:all_stu){
        if(myset.empty()||!(stu==myset.top())){
            myset.push(stu);
        }
        if(myset.size()>3) break;
        
        cout << stu.name << " "<<stu.chinese<<" " << stu.math << " "<<stu.english <<endl;
        
    }


    return 0;
}